<template>
	<view>
		<web-view :src="webUrl"></web-view>
	</view>
</template>

<script>
	import {
		personalData
	} from '../../api/api.js'
	export default {
		data() {
			return {
				webUrl: '',
				userInfo: {},
				refreshCount: 0 // 用于记录刷新次数
			};
		},
		onLaunch() {
			// uni.onAppShow((res) => {
			// 	if (res.query.action === 'goBack') {
			// 		// 执行返回操作
			// 		uni.navigateBack();
			// 	}
			// });

			// console.log('App Launch');
			// const url = plus.runtime.arguments;
			// if (url === 'home') {
			// 	uni.switchTab({
			// 		url: '/pages/goodsIndex/index' 
			// 	});
			// }
		},
		onShow() {
			this.personalData();
		},
		methods: {
			personalData() {
				let data = {}
				personalData(data).then(res => {
					this.userInfo = res.data;
					console.log(this.userInfo)
					let token = uni.getStorageSync('token');
					console.log(token)
					// this.webUrl =
					// 	`http://47.120.64.26:9002?userId=${this.userInfo.UserId}&nickName=${this.userInfo.userName}&token=${token}&timestamp=${Date.now()}&random=${Math.random()}`
					this.webUrl =
						`http://192.168.3.76:8084?userId=${this.userInfo.UserId}&nickName=${this.userInfo.userName}&token=${token}&timestamp=${Date.now()}&random=${Math.random()}`
					// this.webUrl =
					// 	`https://live-h5.huopeng.cc?userId=${this.userInfo.UserId}&nickName=${this.userInfo.userName}&token=${token}&timestamp=${Date.now()}&random=${Math.random()}`
					// 强制刷新页面
					// this.$nextTick(() => {
					// 	window.location.reload();
					// });
				})
			},
		},
		onLoad(e) {
			// this.webUrl = `https://live-h5.huopeng.cc?userId=${e.userId}&nickName=${e.nickName}`
		}
	}
</script>

<style lang="less">

</style>